<!-- saved from url=(0014)about:internet -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>LabeledBubbleRenderer.as</title>
<link rel="stylesheet" type="text/css" href="../../../../../../SourceStyles.css"/>
</head>

<body><pre><span class="ActionScriptpackage">package</span> <span class="ActionScriptDefault_Text">com</span>.<span class="ActionScriptDefault_Text">robsondesign</span>.<span class="ActionScriptDefault_Text">charts</span>.<span class="ActionScriptDefault_Text">renderers</span>
<span class="ActionScriptBracket/Brace">{</span>
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">com</span>.<span class="ActionScriptDefault_Text">robsondesign</span>.<span class="ActionScriptDefault_Text">charts</span>.<span class="ActionScriptDefault_Text">series</span>.<span class="ActionScriptDefault_Text">LabeledBubbleSeries</span>;
    
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">flash</span>.<span class="ActionScriptDefault_Text">display</span>.<span class="ActionScriptDefault_Text">Graphics</span>;
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">flash</span>.<span class="ActionScriptDefault_Text">geom</span>.<span class="ActionScriptDefault_Text">Rectangle</span>;
    
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">mx</span>.<span class="ActionScriptDefault_Text">charts</span>.<span class="ActionScriptDefault_Text">ChartItem</span>;
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">mx</span>.<span class="ActionScriptDefault_Text">charts</span>.<span class="ActionScriptDefault_Text">chartClasses</span>.<span class="ActionScriptDefault_Text">GraphicsUtilities</span>;
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">mx</span>.<span class="ActionScriptDefault_Text">controls</span>.<span class="ActionScriptDefault_Text">Label</span>;
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">mx</span>.<span class="ActionScriptDefault_Text">graphics</span>.<span class="ActionScriptDefault_Text">IFill</span>;
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">mx</span>.<span class="ActionScriptDefault_Text">graphics</span>.<span class="ActionScriptDefault_Text">IStroke</span>;
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">mx</span>.<span class="ActionScriptDefault_Text">graphics</span>.<span class="ActionScriptDefault_Text">SolidColor</span>;
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">mx</span>.<span class="ActionScriptDefault_Text">styles</span>.<span class="ActionScriptDefault_Text">StyleManager</span>;
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">mx</span>.<span class="ActionScriptDefault_Text">utils</span>.<span class="ActionScriptDefault_Text">ColorUtil</span>;

    <span class="ActionScriptASDoc">/**
     * Renders a chart bubble with a label. The label will only display properly if the
     * parent series is an instance of LabeledBubbleSeries. 
     */</span>
    <span class="ActionScriptReserved">public</span> <span class="ActionScriptclass">class</span> <span class="ActionScriptDefault_Text">LabeledBubbleRenderer</span> <span class="ActionScriptReserved">extends</span> <span class="ActionScriptDefault_Text">Label</span>
    <span class="ActionScriptBracket/Brace">{</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">LabeledBubbleRenderer</span><span class="ActionScriptBracket/Brace">()</span>
        <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">super</span><span class="ActionScriptBracket/Brace">()</span>;
        <span class="ActionScriptBracket/Brace">}</span>
        
        <span class="ActionScriptReserved">override</span> <span class="ActionScriptReserved">public</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptReserved">set</span> <span class="ActionScriptDefault_Text">data</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">value</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Object</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span>
        <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptDefault_Text">_chartItem</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">value</span>;
            <span class="ActionScriptDefault_Text">invalidateProperties</span><span class="ActionScriptBracket/Brace">()</span>;
            <span class="ActionScriptDefault_Text">invalidateDisplayList</span><span class="ActionScriptBracket/Brace">()</span>;
        <span class="ActionScriptBracket/Brace">}</span>
        
        <span class="ActionScriptReserved">override</span> <span class="ActionScriptReserved">public</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptReserved">get</span> <span class="ActionScriptDefault_Text">data</span><span class="ActionScriptBracket/Brace">()</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Object</span>
        <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">_chartItem</span>;
        <span class="ActionScriptBracket/Brace">}</span>
        
        
        <span class="ActionScriptReserved">override</span> <span class="ActionScriptReserved">protected</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">updateDisplayList</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">unscaledWidth</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Number</span>, <span class="ActionScriptDefault_Text">unscaledHeight</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Number</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span>
        <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">super</span>.<span class="ActionScriptDefault_Text">updateDisplayList</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">unscaledWidth</span>, <span class="ActionScriptDefault_Text">unscaledHeight</span><span class="ActionScriptBracket/Brace">)</span>;
            
            <span class="ActionScriptComment">/* 
             *    Circle-drawing code is adapted from Adobe&apos;s CircleItemRenderer 
             */</span>
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">fill</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">IFill</span>;
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">state</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;&quot;</span>;
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">color</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">uint</span>;
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">adjustedRadius</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Number</span> <span class="ActionScriptOperator">=</span> 0;
            <span class="ActionScriptComment">// Get fill and state from chartItem if applicable, else use the style property
</span>            <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">_chartItem</span> <span class="ActionScriptReserved">is</span> <span class="ActionScriptDefault_Text">ChartItem</span> <span class="ActionScriptOperator">&amp;&amp;</span> <span class="ActionScriptDefault_Text">_chartItem</span>.<span class="ActionScriptDefault_Text">hasOwnProperty</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&apos;fill&apos;</span><span class="ActionScriptBracket/Brace">))</span>
            <span class="ActionScriptBracket/Brace">{</span>
                 <span class="ActionScriptDefault_Text">fill</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">_chartItem</span>.<span class="ActionScriptDefault_Text">fill</span>;
                 <span class="ActionScriptDefault_Text">state</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">_chartItem</span>.<span class="ActionScriptDefault_Text">currentState</span>;
            <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptReserved">else</span>
            <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptDefault_Text">fill</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">GraphicsUtilities</span>.<span class="ActionScriptDefault_Text">fillFromStyle</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">getStyle</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&apos;fill&apos;</span><span class="ActionScriptBracket/Brace">))</span>;
            <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptComment">// If indicated in chartItem, set color and radius based on mouse-state
</span>            <span class="ActionScriptReserved">switch</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">state</span><span class="ActionScriptBracket/Brace">)</span>
            <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptReserved">case</span> <span class="ActionScriptDefault_Text">ChartItem</span>.<span class="ActionScriptDefault_Text">FOCUSED</span><span class="ActionScriptOperator">:</span>
                <span class="ActionScriptReserved">case</span> <span class="ActionScriptDefault_Text">ChartItem</span>.<span class="ActionScriptDefault_Text">ROLLOVER</span><span class="ActionScriptOperator">:</span>
                    <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">StyleManager</span>.<span class="ActionScriptDefault_Text">isValidStyleValue</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">getStyle</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&apos;itemRollOverColor&apos;</span><span class="ActionScriptBracket/Brace">)))</span>
                        <span class="ActionScriptDefault_Text">color</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">getStyle</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&apos;itemRollOverColor&apos;</span><span class="ActionScriptBracket/Brace">)</span>;
                    <span class="ActionScriptReserved">else</span>
                        <span class="ActionScriptDefault_Text">color</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">ColorUtil</span>.<span class="ActionScriptDefault_Text">adjustBrightness2</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">GraphicsUtilities</span>.<span class="ActionScriptDefault_Text">colorFromFill</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">fill</span><span class="ActionScriptBracket/Brace">)</span>,<span class="ActionScriptOperator">-</span>20<span class="ActionScriptBracket/Brace">)</span>;
                    <span class="ActionScriptDefault_Text">fill</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">SolidColor</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">color</span><span class="ActionScriptBracket/Brace">)</span>;
                    <span class="ActionScriptDefault_Text">adjustedRadius</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">getStyle</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&apos;adjustedRadius&apos;</span><span class="ActionScriptBracket/Brace">)</span>;
                    <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(!</span><span class="ActionScriptDefault_Text">adjustedRadius</span><span class="ActionScriptBracket/Brace">)</span>
                        <span class="ActionScriptDefault_Text">adjustedRadius</span> <span class="ActionScriptOperator">=</span> 0;
                    <span class="ActionScriptReserved">break</span>;
                <span class="ActionScriptReserved">case</span> <span class="ActionScriptDefault_Text">ChartItem</span>.<span class="ActionScriptDefault_Text">DISABLED</span><span class="ActionScriptOperator">:</span>
                    <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">StyleManager</span>.<span class="ActionScriptDefault_Text">isValidStyleValue</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">getStyle</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&apos;itemDisabledColor&apos;</span><span class="ActionScriptBracket/Brace">)))</span>
                        <span class="ActionScriptDefault_Text">color</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">getStyle</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&apos;itemDisabledColor&apos;</span><span class="ActionScriptBracket/Brace">)</span>;
                    <span class="ActionScriptReserved">else</span>
                        <span class="ActionScriptDefault_Text">color</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">ColorUtil</span>.<span class="ActionScriptDefault_Text">adjustBrightness2</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">GraphicsUtilities</span>.<span class="ActionScriptDefault_Text">colorFromFill</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">fill</span><span class="ActionScriptBracket/Brace">)</span>,20<span class="ActionScriptBracket/Brace">)</span>;
                    <span class="ActionScriptDefault_Text">fill</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">SolidColor</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">GraphicsUtilities</span>.<span class="ActionScriptDefault_Text">colorFromFill</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">color</span><span class="ActionScriptBracket/Brace">))</span>;
                    <span class="ActionScriptReserved">break</span>;
                <span class="ActionScriptReserved">case</span> <span class="ActionScriptDefault_Text">ChartItem</span>.<span class="ActionScriptDefault_Text">FOCUSEDSELECTED</span><span class="ActionScriptOperator">:</span>
                <span class="ActionScriptReserved">case</span> <span class="ActionScriptDefault_Text">ChartItem</span>.<span class="ActionScriptDefault_Text">SELECTED</span><span class="ActionScriptOperator">:</span>
                    <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">StyleManager</span>.<span class="ActionScriptDefault_Text">isValidStyleValue</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">getStyle</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&apos;itemSelectionColor&apos;</span><span class="ActionScriptBracket/Brace">)))</span>
                        <span class="ActionScriptDefault_Text">color</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">getStyle</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&apos;itemSelectionColor&apos;</span><span class="ActionScriptBracket/Brace">)</span>;
                    <span class="ActionScriptReserved">else</span>
                        <span class="ActionScriptDefault_Text">color</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">ColorUtil</span>.<span class="ActionScriptDefault_Text">adjustBrightness2</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">GraphicsUtilities</span>.<span class="ActionScriptDefault_Text">colorFromFill</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">fill</span><span class="ActionScriptBracket/Brace">)</span>,<span class="ActionScriptOperator">-</span>30<span class="ActionScriptBracket/Brace">)</span>;
                    <span class="ActionScriptDefault_Text">fill</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">SolidColor</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">color</span><span class="ActionScriptBracket/Brace">)</span>;
                    <span class="ActionScriptDefault_Text">adjustedRadius</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">getStyle</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&apos;adjustedRadius&apos;</span><span class="ActionScriptBracket/Brace">)</span>;
                    <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(!</span><span class="ActionScriptDefault_Text">adjustedRadius</span><span class="ActionScriptBracket/Brace">)</span>
                        <span class="ActionScriptDefault_Text">adjustedRadius</span> <span class="ActionScriptOperator">=</span> 0;
                    <span class="ActionScriptReserved">break</span>;
            <span class="ActionScriptBracket/Brace">}</span>
            
            <span class="ActionScriptComment">// Establish the stroke, width, and height
</span>            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">stroke</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">IStroke</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">getStyle</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&quot;stroke&quot;</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">weight</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Number</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">stroke</span> <span class="ActionScriptOperator">?</span> <span class="ActionScriptDefault_Text">stroke</span>.<span class="ActionScriptDefault_Text">weight</span> <span class="ActionScriptOperator">/</span> 2 <span class="ActionScriptOperator">:</span> 0;
            <span class="ActionScriptDefault_Text">_rcFill</span>.<span class="ActionScriptDefault_Text">right</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">unscaledWidth</span>;
            <span class="ActionScriptDefault_Text">_rcFill</span>.<span class="ActionScriptDefault_Text">bottom</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">unscaledHeight</span>;
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">ht</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Number</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">unscaledHeight</span> <span class="ActionScriptOperator">-</span> 2 <span class="ActionScriptOperator">*</span> <span class="ActionScriptDefault_Text">weight</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">adjustedRadius</span> <span class="ActionScriptOperator">*</span> 2;
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">wd</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Number</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">unscaledWidth</span> <span class="ActionScriptOperator">-</span> 2 <span class="ActionScriptOperator">*</span> <span class="ActionScriptDefault_Text">weight</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">adjustedRadius</span> <span class="ActionScriptOperator">*</span> 2;
            <span class="ActionScriptComment">// Draw the circle
</span>            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">g</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Graphics</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">graphics</span>;
            <span class="ActionScriptDefault_Text">g</span>.<span class="ActionScriptDefault_Text">clear</span><span class="ActionScriptBracket/Brace">()</span>;        
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">stroke</span><span class="ActionScriptBracket/Brace">)</span>
                <span class="ActionScriptDefault_Text">stroke</span>.<span class="ActionScriptDefault_Text">apply</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">g</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">fill</span><span class="ActionScriptBracket/Brace">)</span>
                <span class="ActionScriptDefault_Text">fill</span>.<span class="ActionScriptDefault_Text">begin</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">g</span>, <span class="ActionScriptDefault_Text">_rcFill</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptDefault_Text">g</span>.<span class="ActionScriptDefault_Text">drawEllipse</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">weight</span> <span class="ActionScriptOperator">-</span> <span class="ActionScriptDefault_Text">adjustedRadius</span>, <span class="ActionScriptDefault_Text">weight</span> <span class="ActionScriptOperator">-</span> <span class="ActionScriptDefault_Text">adjustedRadius</span>, <span class="ActionScriptDefault_Text">wd</span>, <span class="ActionScriptDefault_Text">ht</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">fill</span><span class="ActionScriptBracket/Brace">)</span>
                <span class="ActionScriptDefault_Text">fill</span>.<span class="ActionScriptDefault_Text">end</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">g</span><span class="ActionScriptBracket/Brace">)</span>; 
                <span class="ActionScriptComment">// end circle-drawing code
</span>            
            <span class="ActionScriptComment">// Set the label properties
</span>            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">labelParent</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">LabeledBubbleSeries</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">parent</span> <span class="ActionScriptReserved">as</span> <span class="ActionScriptDefault_Text">LabeledBubbleSeries</span>;
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">vAlign</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>;
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">halfFont</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Number</span>;
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">topPadding</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Number</span> <span class="ActionScriptOperator">=</span> 3;
            <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">labelParent</span><span class="ActionScriptBracket/Brace">)</span>
            <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">_chartItem</span>.<span class="ActionScriptDefault_Text">item</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">labelParent</span>.<span class="ActionScriptDefault_Text">labelField</span><span class="ActionScriptBracket/Brace">]</span>;
                <span class="ActionScriptDefault_Text">vAlign</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">getStyle</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&quot;textVAlign&quot;</span><span class="ActionScriptBracket/Brace">)</span>;
                <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">vAlign</span> <span class="ActionScriptOperator">!=</span> <span class="ActionScriptString">&quot;top&quot;</span><span class="ActionScriptBracket/Brace">)</span>
                <span class="ActionScriptBracket/Brace">{</span>
                    <span class="ActionScriptDefault_Text">halfFont</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">getStyle</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&quot;fontSize&quot;</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">/</span>2;
                    <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">vAlign</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptString">&quot;middle&quot;</span><span class="ActionScriptBracket/Brace">)</span>
                    <span class="ActionScriptBracket/Brace">{</span>
                        <span class="ActionScriptDefault_Text">topPadding</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">ht</span><span class="ActionScriptOperator">/</span>2<span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptOperator">-</span> <span class="ActionScriptDefault_Text">halfFont</span>;
                    <span class="ActionScriptBracket/Brace">}</span>
                    <span class="ActionScriptReserved">else</span> <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">vAlign</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptString">&quot;bottom&quot;</span><span class="ActionScriptBracket/Brace">)</span>
                    <span class="ActionScriptBracket/Brace">{</span>
                        <span class="ActionScriptDefault_Text">topPadding</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">ht</span> <span class="ActionScriptOperator">-</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">getStyle</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&quot;fontSize&quot;</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptOperator">+</span> 7<span class="ActionScriptBracket/Brace">)</span>;
                    <span class="ActionScriptBracket/Brace">}</span>
                <span class="ActionScriptBracket/Brace">}</span>
                <span class="ActionScriptDefault_Text">setStyle</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&quot;paddingTop&quot;</span>, <span class="ActionScriptDefault_Text">topPadding</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptBracket/Brace">}</span>
            
        <span class="ActionScriptBracket/Brace">}</span>
        
        <span class="ActionScriptReserved">private</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">_rcFill</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Rectangle</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Rectangle</span>;
        <span class="ActionScriptReserved">private</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">_chartItem</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Object</span>;
    <span class="ActionScriptBracket/Brace">}</span>
<span class="ActionScriptBracket/Brace">}</span></pre></body>
</html>
